import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('../views/index.vue')
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/news',
    name: 'news',
    component: () => import('../views/news.vue')
  },
  {
    path: '/newInfo',
    name: 'newInfo',
    component: () => import('../views/newInfo.vue')
  },
  {
    path: '/Purchase_on_behalf',
    name: 'Purchase_on_behalf',
    component: () => import('../views/Purchase_on_behalf.vue')
  },
  {
    path: '/Inventory_management',
    name: 'Inventory_management',
    component: () => import('../views/Inventory_management.vue')
  },
  {
    path: '/agency_purchase',
    name: 'agency_purchase',
    component: () => import('../views/agency_purchase.vue')
  },
  {
    path: '/vip',
    name: 'vip',
    component: () => import('../views/vip.vue')
  },
  {
    path: '/call_center',
    name: 'call_center',
    component: () => import('../views/call_center.vue')
  },
  {
    path: '/carriage',
    name: 'carriage',
    component: () => import('../views/carriage.vue')
  },
  {
    name: '404',
    path: '/404',
    component: () => import('@/views/404/404.vue')
  },
  {
    path: '*',
     component: () => import('@/views/404/404.vue')
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})
// 解决重复点击导航时，控制台出现报错
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
export default router
